import { useNavigate, useLocation } from 'react-router-dom';
import { Layout, Menu, Button, Avatar, Dropdown } from 'antd';
import menu from '@/config/menu';
const { Sider } = Layout;
const index = ({ collapsed }) => {
  const router = useNavigate();
  const location = useLocation();
  const handleMenuClick = ({ key }) => {
    if (location.pathname !== key) router(key);
  };
  return (
    <Sider trigger={null} collapsible collapsed={collapsed} className="bg-white">
      <Menu mode="inline" selectedKeys={[location.pathname]} onClick={handleMenuClick} items={menu} />
    </Sider>
  );
};
export default index;
